<!-- 地球化学探测测线-线 -->
<template>
  <el-drawer v-model="addDrawer" size="45%" :show-close="false" @opened="openDrawer" @close="closeDrawer">
    <template #title>
      <el-space direction="vertical" class="space-width100">
        <div v-if="route.path.includes('dataIntegrate') && form.qcOpinion">
          <el-form :model="form" :inline="true" label-width="140px">
            <el-form-item label="质检不通过原因" style="width: 100%">
              <el-input v-model="form.qcOpinion" type="textarea" :autosize="{ minRows: 4, maxRows: 6 }" resize="none"
                clearable></el-input>
            </el-form-item>
          </el-form>
        </div>
        <h2>
          <el-row justify="space-between">
            <span><svg-icon icon-class="list"></svg-icon><span style="padding-left: 15px">{{ typeName }}</span></span>
            <el-button type="primary" @click="confirmClick" :disabled="drawerLoading"
              v-if="isShowSave">保存</el-button>
          </el-row>
        </h2>
      </el-space>
    </template>
    <template #default>
      <el-form :model="form" ref="addRef" :inline="true" :rules="formRules" label-width="140px" v-loading="drawerLoading">
        <el-row justify="space-between">
          <el-form-item label="省">
            <el-input v-model="form.province" clearable disabled></el-input>
          </el-form-item>
          <el-form-item label="市">
            <el-input v-model="form.city" clearable disabled></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="区/县">
            <el-input v-model="form.county" clearable disabled></el-input>
          </el-form-item>
          <el-form-item label="测线编号" prop="id">
            <el-input v-model="form.id" placeholder="请输入测线编号" clearable maxlength="17"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="测线所属工程编号" prop="projectId">
            <el-input v-model="form.projectId" placeholder="请输入测线所属工程编号" clearable maxlength="17"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="测线名称" prop="name" style="width: 100%">
            <el-input v-model="form.name" placeholder="请输入测线名称" clearable :autosize="{ minRows: 2, maxRows: 4 }"
              type="textarea" show-word-limit maxlength="40" resize="none"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="探测方法" prop="svyMethod">
            <dict-select :code="checkDict('svyMethod', 'L3')" :value="form.svyMethod" @update="updateDict('svyMethod', $event)"></dict-select>
          </el-form-item>
          <el-form-item label="测线长度 [米]" prop="length">
            <el-input v-model="form.length" placeholder="请输入测线长度 [米]" clearable maxlength="4"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="测线起点经度" prop="startLongitude">
            <el-input v-model="form.startLongitude" placeholder="请输入测线起点经度" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="测线起点纬度" prop="startLatitude">
            <el-input v-model="form.startLatitude" placeholder="请输入测线起点纬度" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="测线终点经度" prop="endLongitutde">
            <el-input v-model="form.endLongitutde" placeholder="请输入测线终点经度" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="测线终点纬度" prop="endLatitude">
            <el-input v-model="form.endLatitude" placeholder="请输入测线终点纬度" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="测点数" prop="svyPointNum">
            <el-input v-model="form.svyPointNum" placeholder="请输入测点数" clearable maxlength="4"></el-input>
          </el-form-item>
          <el-form-item label="内插点" prop="interpolateNum">
            <el-input v-model="form.interpolateNum" placeholder="请输入内插点" clearable maxlength="4"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="异常点总数" prop="abnPointNum">
            <el-input v-model="form.abnPointNum" placeholder="请输入异常点总数" clearable maxlength="4"></el-input>
          </el-form-item>
          <el-form-item label="均值" prop="meanValue">
            <el-input v-model="form.meanValue" placeholder="请输入均值" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="滑动" prop="slippageValue">
            <el-input v-model="form.slippageValue" placeholder="请输入滑动" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="异常下限值" prop="abnormalBottomValue">
            <el-input v-model="form.abnormalBottomValue" placeholder="请输入异常下限值" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="分析结果图图像文件编号" prop="rmAiid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.rmAiid" placeholder="请输入分析结果图图像文件编号" clearable maxlength="20"></el-input>
              <ImageUpload v-model="form.rmAiidName" @uploadImage="uploadSuccess('rmAiid', $event)"
                @delFile="deleteFile('rmAiid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="分析结果图原始表索引号" prop="rmArwid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.rmArwid" placeholder="请输入分析结果图原始表索引号" clearable maxlength="20"></el-input>
              <FileUpload v-model="form.rmArwidName" @uploadFile="uploadSuccess('rmArwid', $event)"
                @delFile="deleteFile('rmArwid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="显示码" prop="showCode">
            <el-input v-model="form.showCode" placeholder="请输入显示码" clearable maxlength="4"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="备注" prop="commentInfo" style="width:100%">
            <el-input v-model="form.commentInfo" placeholder="请输入备注" :autosize="{ minRows: 6, maxRows: 12 }"
              type="textarea" show-word-limit maxlength="2147483647" clearable></el-input>
          </el-form-item>
        </el-row>
      </el-form>
    </template>
  </el-drawer>
</template>
<script setup>
import useSpatialData from '@/hooks/useSpatialData'
import { eightDouble, fourInt } from '@/utils/validate'
import { checkDict } from '@/views/businessManage/common/dict'
const { route, addDrawer, drawerLoading, form, typeName, openDrawer, closeDrawer, confirmClick, uploadSuccess, deleteFile, updateDict, isShowSave } = useSpatialData()

const formRules = {
  id: [{ required: true, message: '请填写测线编号！', trigger: 'blur' }],
  projectId: [{ required: true, message: '请填写测线所属工程编号！', trigger: 'blur' }],
  length: [fourInt],
  startLongitude: [eightDouble],
  startLatitude: [eightDouble],
  endLongitutde: [eightDouble],
  endLatitude: [eightDouble],
  svyPointNum: [fourInt],
  interpolateNum: [fourInt],
  abnPointNum: [fourInt],
  meanValue: [eightDouble],
  slippageValue: [eightDouble],
  abnormalBottomValue: [eightDouble],
  showCode: [fourInt]
}
</script>